package com.dc.designPattern._22_responsibilitychain.impl;

/**
 * Description: 责任链模式_客户端
 * @author: gdc
 * @date: 2021/6/10
 * @version 1.0
 */
public class Client {

    public static void main(String[] args){
        // step 1 创建相关审批人
        DepartmentApprover departmentApprover = new DepartmentApprover("张", 1);
        CollegeApprover collegeApprover = new CollegeApprover("李", 3);
        ViceSchoolMasterApprover viceSchoolMasterApprover = new ViceSchoolMasterApprover("王", 7);
        SchoolMasterApprover schoolMasterApprover = new SchoolMasterApprover("孙", null);

        // step 2 设置下一级审批人
        departmentApprover.setApprover(collegeApprover);
        collegeApprover.setApprover(viceSchoolMasterApprover);
        viceSchoolMasterApprover.setApprover(schoolMasterApprover);

        // step 3 创建 处理请求
        //LeaveRequest request = new LeaveRequest(1, 1);
        //LeaveRequest request = new LeaveRequest(1, 2);
        LeaveRequest request = new LeaveRequest(1, 5);
        //LeaveRequest request = new LeaveRequest(1, 100);
        departmentApprover.handleRequest(request);
    }

}
